<template>
	<view class="theme-item">
		<navigator v-if="!isMore" :url="'/pages/classify-list/classify-list?class_id=' + item._id + '&title='+item.name" class="box">			
			<image class="img" :src="item.picurl" mode="aspectFill"></image>
			<view class="tab"></view>
			<view class="tab-text">{{compareTimestamp(item.updateTime) ? compareTimestamp(item.updateTime) + '前更新' : '刚刚更新'}}</view>
			<view class="mask"></view>
			<view class="title">{{item.name}}</view>
		</navigator>
		<!-- 更多 -->
		<navigator v-else url="/pages/classify/classify" open-type="switchTab" class="box more">
			<image class="img" src="/common/images/more.jpg" mode="aspectFill"></image>
			<view class="mask"></view>
			<view class="content">				
				<uni-icons type="more-filled" size="28" color="#fff"></uni-icons>
				<text class="">更多</text>
			</view>
		</navigator>
	</view>
</template>

<script setup>
	import {compareTimestamp} from '../../utils/common.js';
	defineProps({
		isMore: {
			type: Boolean,
			default: false,
		},
		item: {
			type: Object,
			default() {
				return {
					picurl: null,
					updateTime: compareTimestamp(Date.now() - 1000 * 60 * 60 * 5),
					name: '默认名称',
				}
			}
		}
	})
</script>

<style lang="scss" scoped>
	.theme-item {
		.box {
			height: 340rpx;
			border-radius: 10rpx;
			overflow: hidden;
			position: relative;
			.img {
				width: 100%;
				height: 100%;
			}
			.mask, .title{
				width: 100%;
				height: 70rpx;
				position: absolute;
				left: 0;
				bottom: -2rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-weight: 600;
				color: #f2f2f2;
			}
			.mask {
				background-color: rgba(0, 0, 0, 0.2);
				backdrop-filter: blur(10rpx);
			}
			.tab, .tab-text {
				position: absolute;
				top: 0;
				left: 0;
				padding: 4rpx 14rpx;
				border-radius: 0 0 20rpx 0;
				background-color: rgba(255, 127, 80, 0.7);
				font-size: 22rpx;
				color: #f2f2f2;
				transform: scale(0.9);
				transform-origin: left top;
			}
			.tab {
				backdrop-filter: blur(20rpx);
			}
		}
		.more {
			.mask,.content {
				width: 100%;
				height: 101%;
			}
			.content {
				position: absolute;
				left: 0;
				bottom: -2rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				flex-direction: column;
				font-weight: 600;
				color: #fff;
			} 
		}
	}
</style>